<!-- 意见征集签发意见 -->
<template>
	<view>
		<view class="page" :style="!isData?'display:flex;width: 100vw;height:100vh;align-items:center;justify-content: center;':''">
			<template v-if="isData">
				<view class="list" v-for="(item,index) in dataList" :key="index">
					<view class="">
						<view class="option">
							<view class="lf">部门</view>
							<view class="rl">{{ item.empDepartIds_dictText }}</view>
						</view>
						<view class="option">
							<view class="lf">人员</view>
							<view class="rl">{{ item.empId_dictText }}</view>
						</view>
						<view class="option">
							<view class="lf">签发意见</view>
							<view class="rl">{{ item.opinion }}</view>
						</view>
						<view class="option">
							<view class="lf">签发时间</view>
							<view class="rl">{{ item.timeIssue }}</view>
						</view>
					</view>
				</view>
				<!-- 加载更多显示 -->
				<view class=""><u-loadmore :status="statusLoadmore" /></view>
			</template>
			<view v-else>
				<u-empty
					mode="data"
					icon="/static/empty/data.png"
				>
				</u-empty>
			</view>
		</view>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>
<script>
	import http from '@/utils/request'
	import { mapState } from 'vuex'
	export default {
		data() {
			return {
				id: '', // 选中的id
				page: {
					pageNo: 1,
					pageSize: 10,
				},
				dataList: [] ,// 列表
				isData: true, // 判断是否有数据  true 代表有 false 代表无
				statusLoadmore: 'loadmore', // 通过status设置组件的状态，加载前值为loadmore，加载中为loading，没有数据为nomore
				screenShow: false, // 筛选弹窗
				
				// 传的参数
				queryParam: {
					realname: ''
				},
				
				objectField: '', // 点击确认需要修改的字段
			}
		},
		onLoad(options) {
			this.id = options.id || ''
			this.geterpOmcTeamManagerList() // 获取列表
		},
		methods: {
			...mapState(['userInfo']),
			// 获取列表
			geterpOmcTeamManagerList () {
				this.statusLoadmore = 'loading' // 加载中
				var params = {
					noticeId: this.id,
					collectId: this.id,
					pageNo: this.page.pageNo,
					pageSize: this.page.pageSize,
					
				}
				if (this.queryParam.realname) {
					params.realname = this.queryParam.realname
				}
				http.get('/api/erp/publishCollect/emp/opinionList', params).then(async res => {
					if (res.success) {
						 // 判断首次加载是否有数据
						if (this.page.pageNo == 1){
							if (res.result.records&&res.result.records.length) {
								this.isData = true
							} else {
								this.isData = false
							}
							this.dataList = res.result.records
						} else {
							this.dataList = this.dataList.concat(res.result.records)
						}
						if (res.result.records&&res.result.records.length){
							if (res.result.records.length >= 10 ) {
								this.statusLoadmore = 'loadmore'
							} else {
								this.statusLoadmore = 'nomore'
							}
						}else {
							this.statusLoadmore = 'nomore'
						}
					}
				})
			}
		},
		onReachBottom() {
			if (this.statusLoadmore == 'nomore') return false
			this.page.pageNo = ++ this.page.pageNo;
			this.geterpOmcTeamManagerList()
		}
		
	}
</script>
<style lang="scss" scoped>
.page {
	padding: 0 20rpx 20rpx 20rpx;
	.list{
		border-radius: 10rpx;
		box-shadow: 0px 4px 20px 0px rgba(0,0,0,0.1);
		padding: 12rpx 20rpx 20rpx 20rpx;
		background: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-top: 20rpx;
	}
}

// 按钮
.btn{
	position: fixed;
	bottom: 20rpx;
	width: 95%;
}
</style>
